{% extends "base_page.html" %}

{% block page_title %}{{ resdb }}{% endblock %}

{% block content %}
<div class="container-fluid">
    <table class="table table-bordered">
        <caption><h4>Printer Info</h4></caption>
        <thead>
        <tr style="background-color: #add8e6;">
            <th>ConnectType</th>
            <th>Tickets</th>
            <th>TreeList</th>
            <th>PrinterName</th>
            <th>FirmwareNumber</th>
            <th>SerialNumber</th>
        </tr>
        </thead>
        <tr>
            <td>{{ pd[4] }}</td>
            <td>{{ pd[5] }}</td>
            <td>{{ pd[6] }}</td>
            <td>{{ pd[1] }}</td>
            <td>{{ pd[2] }}</td>
            <td>{{ pd[3] }}</td>
        </tr>
    </table>

    <h4 style="text-align: center;" data-toggle="collapse" data-target="#dTreeTable">DiscoverTree Check Result</h4>
    <hr />

    <div class="collapse" id="dTreeTable">
        <table class="table table-hover table-bordered">
            <thead>
            <tr style="background-color: #add8e6;">
                <th>eTree Local</th>
                <th>eTree on Printer</th>
                <th>All Tags Equal?</th>
                <th>All Texts Equal?</th>
            </tr>
            </thead>
            {% for row in dTree2 %}
            <tr>
                <td>{{ row[1] }}</td>
                <td>{{ row[2] }}</td>
                <td>{{ row[3] }}</td>
                <td>{{ row[4] }}</td>
            </tr>
            {% endfor %}
        </table>
        <table class="table table-hover table-bordered">
            <thead>
            <tr style="background-color: #add8e6;">
                <th>TreeName</th>
                <th>Action</th>
                <th>Result</th>
                <th>Reason</th>
                <th>ConnectType</th>

            </tr>
            </thead>
            {% for row in dTree %}
                <tr>
                    <td>{{ row[1] }}</td>
                    <td>{{ row[2] }}</td>
                    {% if row[3] == "Fail" %}
                        <td style="color: red; font-weight: bold;">{{ row[3] }}</td>
                    {% else %}
                        <td style="color: green;">{{ row[3] }}</td>
                    {% endif %}
                    <td>{{ row[4] }}</td>
                    <td>{{ row[6] }}</td>
                </tr>
            {% endfor %}
        </table>
    </div>

    {% for k, v in resD %}
        <h4 style="text-align: center;" data-toggle="collapse" data-target="#{{ k.replace(" ", "_") }}">{{ k }}</h4>
        <hr />
        <div class="collapse" id="{{ k.replace(" ", "_") }}">
        <table class="table table-hover table-bordered">
            <thead>
            <tr style="background-color: #add8e6;">
                <th>#</th>
                <th>Case Name</th>
                <th>Action</th>
                <th>Description</th>
                <th>Expected Result</th>
                <th>Result</th>
                <th>Status</th>
                <th>Reason</th>
                <th>OutputFile</th>
                <th>InputFile</th>
                <th>isEqual</th>
                <th>HTTP/S</th>
            </tr>
            </thead>
            {% for entry in v %}
                {% if entry[5] == 0 %}

                <tr class="warning">
                    <td>{{ entry[11]}}</td>
                    <td>{{ entry[1]}}</td>
                    <td>{{ entry[2]}}</td>
                    <td>
                        {{ entry[3] }}
                    </td>
                    <td>{{ entry[4]}}</td>
                    <td style="color: red; font-weight: bold;">Fail</td>
                    <td>{{ entry[6]}}</td>
                    <td>{{ entry[7]}}</td>
                    {% if entry[8] == "No OutputFile" %}
                        <td></td>
                    {% else  %}
                        <td><a href="#{{ entry[0] }}" role="button" class="btn" data-toggle="modal">View</a></td>
                    {% endif %}
                    {% if entry[9] == "No InputFile" %}
                        <td></td>
                    {% else %}
                        <td><a href="#{{ entry[0] }}2" role="button" class="btn" data-toggle="modal">View</a></td>
                    {% endif %}
                    <td>{{ entry[10]}}</td>
                    <td>{{ entry[12] }}</td>
                </tr>
                {% else %}
                <tr>
                    <td>{{ entry[11]}}</td>
                    <td>{{ entry[1]}}</td>
                    <td>{{ entry[2]}}</td>
                    <td>{{ entry[3]}}</td>
                    <td>{{ entry[4]}}</td>
                    <td style="color: green;">Pass</td>
                    <td>{{ entry[6]}}</td>
                    <td>{{ entry[7]}}</td>
                    {% if entry[8] == "No OutputFile" %}
                        <td></td>
                    {% else  %}
                        <td><a href="#{{ entry[0] }}" role="button" class="btn" data-toggle="modal">View</a></td>
                    {% endif %}
                    {% if entry[9] == "No InputFile" %}
                        <td></td>
                    {% else %}
                        <td><a href="#{{ entry[0] }}2" role="button" class="btn" data-toggle="modal">View</a></td>
                    {% endif %}
                    <td>{{ entry[10]}}</td>
                    <td>{{ entry[12] }}</td>
                </tr>
                {% endif %}
                <div class="modal hide fade" id="{{ entry[0] }}">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h3>File Contents</h3>
                    </div>
                    <div class="modal-body">
                    {% if entry[8] %}
                        {{ entry[8] }}
                    {% endif %}
                    </div>
                </div>

                <div class="modal hide fade" id="{{ entry[0] }}2">
                    <div class="modal-header">
                        <button type="button" class="close" data-dismiss="modal">&times;</button>
                        <h3>File Contents</h3>
                    </div>
                    <div class="modal-body">
                        {% if entry[9] %}
                            {{ entry[9] }}
                        {% endif %}
                    </div>
                </div>
            {% endfor %}
    </table>
    </div>
    {% endfor %}
</div> <!-- container fluid -->



{% endblock %}

